#ifndef WAYPOINT_LIST_H_
#define WAYPOINT_LIST_H_

#include <cstdlib>
#include <stdio.h>   // Standard input/output definitions
#include <unistd.h>  // UNIX standard function definitions
#include <fcntl.h>   // File control definitions
#include <termios.h> // POSIX terminal control definitions

#include <common/mavlink.h>

#define SAFE_LANDING_POINT_NUMBER 5


#ifndef HAVE_STRUCT_WAYPOINTS_LOCAL_T
#define HAVE_STRUCT_WAYPOINTS_LOCAL_T
typedef struct _waypoint_t
{
	float x;
	float y;
	float z;
	float speed;
}waypoint_t;
#endif

#ifndef HAVE_STRUCT_WAYPOINT_NODE_T
#define HAVE_STRUCT_WAYPOINT_NODE_T
typedef struct _waypoint_node_t
{
	waypoint_t waypoint;
	uint16_t seq;
	_waypoint_node_t *next;
}waypoint_node_t;
#endif

#ifndef HAVE_STRUCT_MISIION_WAYPOINTS_T
#define HAVE_STRUCT_MISIION_WAYPOINTS_T
typedef struct _mission_waypoints_t
{
	waypoint_t waypoint;
	int seq;
	_mission_waypoints_t *next;
}mission_waypoints_t;
#endif

class waypoint_list_c
{
	waypoint_node_t *head;	
	
public:

	uint16_t count;
	waypoint_t emer_land_node[SAFE_LANDING_POINT_NUMBER];
	waypoint_list_c();	
	~waypoint_list_c();
	uint16_t insert_waypoint(uint16_t list_num, waypoint_t waypoint_item); 
	uint16_t delete_waypoint(uint16_t list_num);
	waypoint_t get_waypoint(uint16_t list_num); 
	waypoint_t get_headpoint();
	int clear(void);

};



#endif
